]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
TelepathyClient: Simplify the channel filter specifications
authorDan Winship <danw@gnome.org>
Fri, 16 Apr 2010 19:18:32 +0000 (15:18 -0400)
committerDan Winship <danw@gnome.org>
Mon, 17 May 2010 13:48:09 +0000 (09:48 -0400)
https://bugzilla.gnome.org/show_bug.cgi?id=611613

js/ui/telepathyClient.js

index ea330532e18359f2db056b87bab9193c28e39059..1823820dc4ee886d72fc7d265f0cac7b439d375a 100644 (file)
@@ -19,6 +19,22 @@ const SCROLLBACK_RECENT_TIME = 15 * 60; // 15 minutes
 const SCROLLBACK_RECENT_LENGTH = 20;
 const SCROLLBACK_IDLE_LENGTH = 5;
 
+// A 'Qualified_Property_Value_Map' that represents a single-user
+// text-based chat.
+let singleUserTextChannel = {};
+singleUserTextChannel[Telepathy.CHANNEL_NAME + '.ChannelType'] = Telepathy.CHANNEL_TEXT_NAME;
+singleUserTextChannel[Telepathy.CHANNEL_NAME + '.TargetHandleType'] = Telepathy.HandleType.CONTACT;
+
+// Some protocols only support 'multi-user' chats, and single-user
+// chats are just treated as multi-user chats with only one other
+// participant. Telepathy uses HandleType.NONE for all chats in these
+// protocols; there's no good way for us to tell if the channel is
+// single- or multi-user.
+let oneOrMoreUserTextChannel = {};
+oneOrMoreUserTextChannel[Telepathy.CHANNEL_NAME + '.ChannelType'] = Telepathy.CHANNEL_TEXT_NAME;
+oneOrMoreUserTextChannel[Telepathy.CHANNEL_NAME + '.TargetHandleType'] = Telepathy.HandleType.NONE;
+
+
 // This is GNOME Shell's implementation of the Telepathy 'Client'
 // interface. Specifically, the shell is a Telepathy 'Observer', which
 // lets us see messages even if they belong to another app (eg,
@@ -83,20 +99,7 @@ Client.prototype = {
     },
 
     get ObserverChannelFilter() {
-        return [
-            // We only care about single-user text-based chats
-            { 'org.freedesktop.Telepathy.Channel.ChannelType': Telepathy.CHANNEL_TEXT_NAME,
-              'org.freedesktop.Telepathy.Channel.TargetHandleType': Telepathy.HandleType.CONTACT },
-
-            // Some protocols only support "multi-user" chats, and
-            // single-user chats are just treated as multi-user chats
-            // with only one other participant. Telepathy uses
-            // HandleType.NONE for all chats in these protocols;
-            // there's no good way for us to tell if the channel is
-            // single- or multi-user.
-            { 'org.freedesktop.Telepathy.Channel.ChannelType': Telepathy.CHANNEL_TEXT_NAME,
-              'org.freedesktop.Telepathy.Channel.TargetHandleType': Telepathy.HandleType.NONE }
-        ];
+        return [ singleUserTextChannel, oneOrMoreUserTextChannel ];
     },
 
     ObserveChannels: function(accountPath, connPath, channels,